package com.yanqu.road.server.cmd.activity.feast;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ShanHeFeastProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;


@Cmd(code = CrossProtocol.C_CROSS_SHAN_HE_FEAST_GET_OTHER_USER_INFO, desc = "查看玩家信息请求")
public class CrossFeastGetOtherUserInfoCmd extends CrossCommand {

    private long otherUserId;
    private long otherServerId;
    private long userId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ShanHeFeastProto.CrossFeastGetOtherUserInfoReqMsg reqMsg = ShanHeFeastProto.CrossFeastGetOtherUserInfoReqMsg.parseFrom(packet.getBytes());
        otherUserId = reqMsg.getUserId();
        otherServerId = reqMsg.getServerId();
        userId = packet.getPlayerId();

        ShanHeFeastProto.FeastGetOtherInfoFromCrossReqMsg.Builder msg = ShanHeFeastProto.FeastGetOtherInfoFromCrossReqMsg.newBuilder();
        msg.setUserId(userId);
        msg.setServerId(serverId);
        msg.setOtherServerId(otherServerId);
        msg.setOtherUserId(otherUserId);
        msg.setActivityId(reqMsg.getActivityId());
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(Protocol.S_SHAN_HE_FEAST_GET_OTHER_INFO_FROM_CROSS, msg);
        MessageHelper.sendPacket(otherServerId, reqMsg.getUserId(), pbMsg);
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
    }

    @Override
    public void sendData() {
    }
}
